package com.zitangkou.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * 全局状态
 *
 * @author Deng Ningning
 * @version 1.0
 * @date 2020/8/14 17:32
 */
@Getter
@Accessors(chain = true)
@AllArgsConstructor
public enum RedisKeyEnum {
    /**
     * 注册短信验证码缓存键
     */
    MOBILE_REGISTER_CODE("mobile:code:register:enterpriseId_%s:mobile_%s", 30),
    /**
     * 登录短信验证码缓存键
     */
    MOBILE_LOGIN_CODE("mobile:code:login:enterpriseId_%s:mobile_%s", 30),
    /**
     * 注册邮箱验证码缓存键
     */
    EMAIL_REGISTER_CODE("email:code:register:enterpriseId_%s:mobile_%s", 30),
    /**
     * 登录邮箱验证码缓存键
     */
    EMAIL_LOGIN_CODE("email:code:login:enterpriseId_%s:mobile_%s", 30),
    /**
     * 用户信息缓存键
     */
    USER_INFO_CODE("user:info:enterpriseId_%s:userAccount_%s", 2 * 60),
    /**
     * 绑定手机验证码缓存键
     */
    MOBILE_BIND_CODE("mobile:code:bind:enterpriseId_%s:mobile_%s", 30),
    /**
     * 绑定邮箱缓存键
     */
    EMAIL_BIND_CODE("mail:code:bind:enterpriseId_%s:email_%s", 30),

    /**
     * 用户模块常量缓存键
     */
    USER_CONSTANT("constant:user:type_%s", 120),

    /**
     * 用户角色缓存键
     */
    USER_ROLE_CONSTANT("constant:user:role_%s", 5),

    /**
     * 忘记密码缓存键
     */
    FORGOT_PASSWORD_CODE("mobile:code:forgot:password:enterpriseId_%s:mobile_%s", 30),

    /**
     * 微信access_token缓存，2小时过期
     */
    WX_ACCESS_TOKEN_KEY("wx:access_token:app_id_%s", 110),

    ;
    /**
     * 状态值
     */
    private final String key;
    /**
     * 过期时间，单位分钟，0 表示永久
     */
    private final Integer minutes;

}
